```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Activiti工作流配置指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .code-block {
            font-family: 'Courier New', Courier, monospace;
            background-color: #f1f5f9;
            border-radius: 0.5rem;
            padding: 1rem;
            overflow-x: auto;
        }
        .xml-tag {
            color: #1e40af;
        }
        .xml-attr {
            color: #7c3aed;
        }
        .xml-value {
            color: #0369a1;
        }
        .java-keyword {
            color: #7e22ce;
            font-weight: bold;
        }
        .java-method {
            color: #2563eb;
        }
        .java-string {
            color: #059669;
        }
        .java-comment {
            color: #64748b;
            font-style: italic;
        }
        .mermaid-container {
            background-color: white;
            border-radius: 0.5rem;
            padding: 1rem;
            margin: 1rem 0;
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
</head>
<body class="min-h-screen">
    <div class="hero text-white py-16 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto">
            <div class="text-center">
                <h1 class="text-4xl font-bold mb-4">Activiti 工作流配置指南</h1>
                <p class="text-xl opacity-90 max-w-3xl mx-auto">专业的工作流引擎整合与开发实践</p>
            </div>
        </div>
    </div>

    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
            <div class="md:col-span-2">
                <div class="bg-white rounded-xl shadow-sm p-6 card">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-cogs mr-2"></i> 配置文件与依赖
                    </h2>
                    
                    <div class="mb-6">
                        <h3 class="text-lg font-medium mb-2 text-gray-800 flex items-center">
                            <i class="fas fa-file-code mr-2 text-blue-600"></i> 配置文件
                        </h3>
                        <p class="mb-4">复制activiti的配置文件activiti-context.xml到工程里面，配置文件在activiti-5.13\wars\activiti-rest\WEB-INF\classes</p>
                    </div>
                    
                    <div>
                        <h3 class="text-lg font-medium mb-2 text-gray-800 flex items-center">
                            <i class="fas fa-archive mr-2 text-blue-600"></i> 依赖包
                        </h3>
                        <ul class="list-disc pl-6 mb-4 space-y-1">
                            <li>导入activiti文件夹activiti-5.13\libs下面的所的包</li>
                            <li>导入其他三个包：
                                <ul class="list-disc pl-6 mt-1">
                                    <li>slf4j-api-1.5.8.jar</li>
                                    <li>slf4j-log4j12.jar</li>
                                    <li>joda-time-2.1.jar</li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <div>
                <div class="bg-white rounded-xl shadow-sm p-6 card">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-code mr-2"></i> Spring整合配置
                    </h2>
                    <div class="code-block">
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"processEngineConfiguration"</span> <span class="xml-attr">class</span>=<span class="xml-value">"org.activiti.spring.SpringProcessEngineConfiguration"</span><span class="xml-tag">&gt;</span><br>
                        <span class="xml-tag">&lt;property</span> <span class="xml-attr">name</span>=<span class="xml-value">"dataSource"</span> <span class="xml-attr">ref</span>=<span class="xml-value">"dataSource"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;property</span> <span class="xml-attr">name</span>=<span class="xml-value">"transactionManager"</span> <span class="xml-attr">ref</span>=<span class="xml-value">"transactionManager"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;property</span> <span class="xml-attr">name</span>=<span class="xml-value">"databaseSchemaUpdate"</span> <span class="xml-attr">value</span>=<span class="xml-value">"true"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;/bean&gt;</span><br><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">class</span>=<span class="xml-value">"org.activiti.spring.ProcessEngineFactoryBean"</span><span class="xml-tag">&gt;</span><br>
                        <span class="xml-tag">&lt;property</span> <span class="xml-attr">name</span>=<span class="xml-value">"processEngineConfiguration"</span> <span class="xml-attr">ref</span>=<span class="xml-value">"processEngineConfiguration"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;/bean&gt;</span><br><br>
                        <span class="xml-tag">&lt;!-- 由流程引擎对象，提供的方法，创建项目中使用的Activiti工作流的Service --&gt;</span><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"repositoryService"</span> <span class="xml-attr">factory-bean</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">factory-method</span>=<span class="xml-value">"getRepositoryService"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"runtimeService"</span> <span class="xml-attr">factory-bean</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">factory-method</span>=<span class="xml-value">"getRuntimeService"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"taskService"</span> <span class="xml-attr">factory-bean</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">factory-method</span>=<span class="xml-value">"getTaskService"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"historyService"</span> <span class="xml-attr">factory-bean</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">factory-method</span>=<span class="xml-value">"getHistoryService"</span> <span class="xml-tag">/&gt;</span><br>
                        <span class="xml-tag">&lt;bean</span> <span class="xml-attr">id</span>=<span class="xml-value">"formService"</span> <span class="xml-attr">factory-bean</span>=<span class="xml-value">"processEngine"</span> <span class="xml-attr">factory-method</span>=<span class="xml-value">"getFormService"</span> <span class="xml-tag">/&gt;</span>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-sm p-6 card mt-8">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-random mr-2"></i> 获取连线信息
                    </h2>
                    <div class="code-block">
                        <span class="java-keyword">public</span> List&lt;String&gt; <span class="java-method">getOutgoingTransitions</span>(String <span class="java-string">taskId</span>) {<br>
                        &nbsp;&nbsp;ProcessEngine <span class="java-method">processEngine</span> = ProcessEngines.<span class="java-method">getDefaultProcessEngine</span>();<br>
                        &nbsp;&nbsp;RepositoryService <span class="java-method">repositoryService</span> = <span class="java-method">processEngine</span>.getRepositoryService();<br>
                        &nbsp;&nbsp;RuntimeService <span class="java-method">runtimeService</span> = <span class="java-method">processEngine</span>.getRuntimeService();<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-comment">// 流程实例id</span><br>
                        &nbsp;&nbsp;String <span class="java-method">processInstanceId</span> = <span class="java-method">processEngine</span>.getTaskService().<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">createTaskQuery</span>().<span class="java-method">taskId</span>(<span class="java-string">taskId</span>).<span class="java-method">singleResult</span>().<span class="java-method">getProcessInstanceId</span>();<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-comment">// 得到流程实例对象</span><br>
                        &nbsp;&nbsp;ProcessInstance <span class="java-method">processInstance</span> = <span class="java-method">runtimeService</span>.<span class="java-method">createProcessInstanceQuery</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">processInstanceId</span>(<span class="java-method">processInstanceId</span>).<span class="java-method">singleResult</span>();<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-comment">// 得到流程定义对象</span><br>
                        &nbsp;&nbsp;ProcessDefinitionEntity <span class="java-method">processDefinitionEntity</span> = (ProcessDefinitionEntity) <span class="java-method">repositoryService</span><br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">getProcessDefinition</span>(<span class="java-method">processInstance</span>.<span class="java-method">getProcessDefinitionId</span>());<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-comment">// 得到活动对象</span><br>
                        &nbsp;&nbsp;ActivityImpl <span class="java-method">findActivity</span> = <span class="java-method">processDefinitionEntity</span>.<span class="java-method">findActivity</span>(<span class="java-method">processInstance</span>.<span class="java-method">getActivityId</span>());<br>
                        &nbsp;&nbsp;List&lt;PvmTransition&gt; <span class="java-method">outgoingTransitions</span> = <span class="java-method">findActivity</span>.<span class="java-method">getOutgoingTransitions</span>();<br>
                        <br>
                        &nbsp;&nbsp;List&lt;String&gt; <span class="java-method">transitionNames</span> = <span class="java-keyword">new</span> ArrayList&lt;&gt;();<br>
                        &nbsp;&nbsp;<span class="java-keyword">for</span> (PvmTransition <span class="java-method">pvmTransition</span> : <span class="java-method">outgoingTransitions</span>) {<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">transitionNames</span>.<span class="java-method">add</span>((String) <span class="java-method">pvmTransition</span>.<span class="java-method">getProperty</span>(<span class="java-string">"name"</span>));<br>
                        &nbsp;&nbsp;}<br>
                        &nbsp;&nbsp;<span class="java-keyword">return</span> <span class="java-method">transitionNames</span>;<br>
                        }
                    </div>
                </div>
            </div>

            <div>
                <div class="bg-white rounded-xl shadow-sm p-6 card">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-play mr-2"></i> 启动流程实例
                    </h2>
                    <div class="code-block">
                        <span class="java-keyword">public</span> <span class="java-keyword">void</span> <span class="java-method">startlevalProcess</span>(WorkFlowBean <span class="java-method">workFlowBean</span>, User <span class="java-method">user</span>) {<br>
                        &nbsp;&nbsp;LeaveBill <span class="java-method">leaveBill</span> = <span class="java-method">leaveBillMapper</span>.<span class="java-method">findLeavebillById</span>(<span class="java-method">workFlowBean</span>.<span class="java-method">getId</span>());<br>
                        &nbsp;&nbsp;String <span class="java-method">processKey</span> = <span class="java-method">leaveBill</span>.<span class="java-method">getClass</span>().<span class="java-method">getSimpleName</span>();<br>
                        &nbsp;&nbsp;String <span class="java-method">userName</span> = <span class="java-method">user</span>.<span class="java-method">getUserChName</span>();<br>
                        &nbsp;&nbsp;Map&lt;String, Object&gt; <span class="java-method">variableMap</span> = <span class="java-keyword">new</span> HashMap&lt;String, Object&gt;();<br>
                        &nbsp;&nbsp;<span class="java-method">variableMap</span>.<span class="java-method">put</span>(<span class="java-string">"userName"</span>, <span class="java-method">userName</span>);<br>
                        &nbsp;&nbsp;String <span class="java-method">bk</span> = <span class="java-method">processKey</span> + <span class="java-string">"."</span> + <span class="java-method">workFlowBean</span>.<span class="java-method">getId</span>();<br>
                        &nbsp;&nbsp;<span class="java-method">runtimeService</span>.<span class="java-method">startProcessInstanceByKey</span>(<span class="java-method">processKey</span>, <span class="java-method">bk</span>, <span class="java-method">variableMap</span>);<br>
                        &nbsp;&nbsp;Map&lt;String, Object&gt; <span class="java-method">paramMap</span> = <span class="java-keyword">new</span> HashMap&lt;String, Object&gt;();<br>
                        &nbsp;&nbsp;<span class="java-method">paramMap</span>.<span class="java-method">put</span>(<span class="java-string">"state"</span>, 1);<br>
                        &nbsp;&nbsp;<span class="java-method">paramMap</span>.<span class="java-method">put</span>(<span class="java-string">"id"</span>, <span class="java-method">workFlowBean</span>.<span class="java-method">getId</span>());<br>
                        &nbsp;&nbsp;<span class="java-method">leaveBillMapper</span>.<span class="java-method">updateLeaveBillState</span>(<span class="java-method">paramMap</span>);<br>
                        }
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-sm p-6 card mt-8">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-tasks mr-2"></i> 查询我的任务
                    </h2>
                    <div class="code-block">
                        User <span class="java-method">user</span> = (User)SecurityUtils.<span class="java-method">getSubject</span>().<span class="java-method">getPrincipal</span>();<br>
                        <br>
                        List&lt;Task&gt; <span class="java-method">list</span> = <span class="java-method">taskService</span>.<span class="java-method">createTaskQuery</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">orderByTaskCreateTime</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">desc</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">taskAssignee</span>(<span class="java-method">user</span>.<span class="java-method">getName</span>())<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">list</span>();
                    </div>
                </div>
            </div>

            <div class="md:col-span-2">
                <div class="bg-white rounded-xl shadow-sm p-6 card">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-check-circle mr-2"></i> 完成我的任务
                    </h2>
                    <div class="code-block">
                        <span class="java-keyword">public</span> <span class="java-keyword">void</span> <span class="java-method">completeTask</span>(WorkFlowBean <span class="java-method">workFlowBean</span>, User <span class="java-method">user</span>) {<br>
                        &nbsp;&nbsp;Long <span class="java-method">id</span> = <span class="java-method">workFlowBean</span>.<span class="java-method">getId</span>(); <span class="java-comment">// 请假id</span><br>
                        &nbsp;&nbsp;String <span class="java-method">taskId</span> = <span class="java-method">workFlowBean</span>.<span class="java-method">getTaskId</span>(); <span class="java-comment">// 任务id</span><br>
                        &nbsp;&nbsp;String <span class="java-method">comment</span> = <span class="java-method">workFlowBean</span>.<span class="java-method">getComment</span>(); <span class="java-comment">// 得到批注</span><br>
                        &nbsp;&nbsp;String <span class="java-method">outcome</span> = <span class="java-method">workFlowBean</span>.<span class="java-method">getOutcome</span>(); <span class="java-comment">// 得到连线名称</span><br>
                        <br>
                        &nbsp;&nbsp;String <span class="java-method">processInstanceId</span> = <span class="java-method">taskService</span>.<span class="java-method">createTaskQuery</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">taskId</span>(<span class="java-method">taskId</span>).<span class="java-method">singleResult</span>().<span class="java-method">getProcessInstanceId</span>();<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-comment">// 添加批注</span><br>
                        &nbsp;&nbsp;Authentication.<span class="java-method">setAuthenticatedUserId</span>(<span class="java-method">user</span>.<span class="java-method">getUserChName</span>());<span class="java-comment">//设置添加批注的人</span><br>
                        &nbsp;&nbsp;<span class="java-method">taskService</span>.<span class="java-method">addComment</span>(<span class="java-method">taskId</span>, <span class="java-method">processInstanceId</span>, <span class="java-method">comment</span>);<br>
                        <br>
                        &nbsp;&nbsp;Map&lt;String, Object&gt; <span class="java-method">map</span> = <span class="java-keyword">new</span> HashMap&lt;String,Object&gt;();<br>
                        &nbsp;&nbsp;<span class="java-keyword">if</span>(<span class="java-method">outcome</span> != <span class="java-keyword">null</span> && !<span class="java-string">"提交"</span>.equals(<span class="java-method">outcome</span>)){<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">map</span>.<span class="java-method">put</span>(<span class="java-string">"outcome"</span>, <span class="java-method">outcome</span>);<br>
                        &nbsp;&nbsp;}<br>
                        <br>
                        &nbsp;&nbsp;<span class="java-method">taskService</span>.<span class="java-method">complete</span>(<span class="java-method">taskId</span>, <span class="java-method">map</span>); <span class="java-comment">// 完成任务</span><br>
                        <br>
                        &nbsp;&nbsp;ProcessInstance <span class="java-method">singleResult</span> = <span class="java-method">runtimeService</span>.<span class="java-method">createProcessInstanceQuery</span>()<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;.<span class="java-method">processInstanceId</span>(<span class="java-method">processInstanceId</span>).<span class="java-method">singleResult</span>();<br>
                        &nbsp;&nbsp;<span class="java-keyword">if</span>(<span class="java-method">singleResult</span> == <span class="java-keyword">null</span>){<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String, Object&gt; <span class="java-method">map1</span> = <span class="java-keyword">new</span> HashMap&lt;&gt;();<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">map1</span>.<span class="java-method">put</span>(<span class="java-string">"state"</span>, 2);<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">map1</span>.<span class="java-method">put</span>(<span class="java-string">"id"</span>, <span class="java-method">id</span>);<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="java-method">leaveBillMapper</span>.<span class="java-method">updateLeaveBillState</span>(<span class="java-method">map1</span>); <span class="java-comment">// 更新状态</span><br>
                        &nbsp;&nbsp;}<br>
                        }
                    </div>
                </div>
            </div>

            <div class="md:col-span-2">
                <div class="bg-white rounded-xl shadow-sm p-6 card">
                    <h2 class="text-2xl font-semibold mb-4 text-blue-800 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 工作流流程图
                    </h2>
                    <div class="mermaid-container">
                        <div class="mermaid">
                            graph TD
                                A[开始] --> B[员工提交请假申请]
                                B --> C{经理审批}
                                C -->|批准| D[总监审批]
                                C -->|拒绝| E[返回修改]
                                D -->|批准| F[人事存档]
                                D -->|拒绝| E
                                E --> B
                                F --> G[结束]
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```